home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / font / AttributeValues.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  17.2 KB  |  1,153 lines

  1. package sun.font;
  2.  
  3. import java.awt.Font;
  4. import java.awt.Paint;
  5. import java.awt.Toolkit;
  6. import java.awt.font.GraphicAttribute;
  7. import java.awt.font.NumericShaper;
  8. import java.awt.font.TextAttribute;
  9. import java.awt.font.TransformAttribute;
  10. import java.awt.geom.AffineTransform;
  11. import java.awt.geom.NoninvertibleTransformException;
  12. import java.awt.geom.Point2D;
  13. import java.awt.im.InputMethodHighlight;
  14. import java.io.Serializable;
  15. import java.text.Annotation;
  16. import java.text.AttributedCharacterIterator;
  17. import java.util.HashMap;
  18. import java.util.Hashtable;
  19. import java.util.Map;
  20. import sun.font.AttributeValues.1;
  21.  
  22. public final class AttributeValues implements Cloneable {
  23.    private int defined;
  24.    private int nondefault;
  25.    private String family = "Default";
  26.    private float weight = 1.0F;
  27.    private float width = 1.0F;
  28.    private float posture;
  29.    private float size = 12.0F;
  30.    private float tracking;
  31.    private NumericShaper numericShaping;
  32.    private AffineTransform transform;
  33.    private GraphicAttribute charReplacement;
  34.    private Paint foreground;
  35.    private Paint background;
  36.    private float justification = 1.0F;
  37.    private Object imHighlight;
  38.    private Font font;
  39.    private byte imUnderline = -1;
  40.    private byte superscript;
  41.    private byte underline = -1;
  42.    private byte runDirection = -2;
  43.    private byte bidiEmbedding;
  44.    private byte kerning;
  45.    private byte ligatures;
  46.    private boolean strikethrough;
  47.    private boolean swapColors;
  48.    private AffineTransform baselineTransform;
  49.    private AffineTransform charTransform;
  50.    private static final AttributeValues DEFAULT = new AttributeValues();
  51.    public static final int MASK_ALL = getMask((EAttribute[])EAttribute.class.getEnumConstants());
  52.    private static final String DEFINED_KEY = "sun.font.attributevalues.defined_key";
  53.  
  54.    public String getFamily() {
  55.       return this.family;
  56.    }
  57.  
  58.    public void setFamily(String var1) {
  59.       this.family = var1;
  60.       this.update(EAttribute.EFAMILY);
  61.    }
  62.  
  63.    public float getWeight() {
  64.       return this.weight;
  65.    }
  66.  
  67.    public void setWeight(float var1) {
  68.       this.weight = var1;
  69.       this.update(EAttribute.EWEIGHT);
  70.    }
  71.  
  72.    public float getWidth() {
  73.       return this.width;
  74.    }
  75.  
  76.    public void setWidth(float var1) {
  77.       this.width = var1;
  78.       this.update(EAttribute.EWIDTH);
  79.    }
  80.  
  81.    public float getPosture() {
  82.       return this.posture;
  83.    }
  84.  
  85.    public void setPosture(float var1) {
  86.       this.posture = var1;
  87.       this.update(EAttribute.EPOSTURE);
  88.    }
  89.  
  90.    public float getSize() {
  91.       return this.size;
  92.    }
  93.  
  94.    public void setSize(float var1) {
  95.       this.size = var1;
  96.       this.update(EAttribute.ESIZE);
  97.    }
  98.  
  99.    public AffineTransform getTransform() {
  100.       return this.transform;
  101.    }
  102.  
  103.    public void setTransform(AffineTransform var1) {
  104.       this.transform = var1 != null && !var1.isIdentity() ? new AffineTransform(var1) : DEFAULT.transform;
  105.       this.updateDerivedTransforms();
  106.       this.update(EAttribute.ETRANSFORM);
  107.    }
  108.  
  109.    public void setTransform(TransformAttribute var1) {
  110.       this.transform = var1 != null && !var1.isIdentity() ? var1.getTransform() : DEFAULT.transform;
  111.       this.updateDerivedTransforms();
  112.       this.update(EAttribute.ETRANSFORM);
  113.    }
  114.  
  115.    public int getSuperscript() {
  116.       return this.superscript;
  117.    }
  118.  
  119.    public void setSuperscript(int var1) {
  120.       this.superscript = (byte)var1;
  121.       this.update(EAttribute.ESUPERSCRIPT);
  122.    }
  123.  
  124.    public Font getFont() {
  125.       return this.font;
  126.    }
  127.  
  128.    public void setFont(Font var1) {
  129.       this.font = var1;
  130.       this.update(EAttribute.EFONT);
  131.    }
  132.  
  133.    public GraphicAttribute getCharReplacement() {
  134.       return this.charReplacement;
  135.    }
  136.  
  137.    public void setCharReplacement(GraphicAttribute var1) {
  138.       this.charReplacement = var1;
  139.       this.update(EAttribute.ECHAR_REPLACEMENT);
  140.    }
  141.  
  142.    public Paint getForeground() {
  143.       return this.foreground;
  144.    }
  145.  
  146.    public void setForeground(Paint var1) {
  147.       this.foreground = var1;
  148.       this.update(EAttribute.EFOREGROUND);
  149.    }
  150.  
  151.    public Paint getBackground() {
  152.       return this.background;
  153.    }
  154.  
  155.    public void setBackground(Paint var1) {
  156.       this.background = var1;
  157.       this.update(EAttribute.EBACKGROUND);
  158.    }
  159.  
  160.    public int getUnderline() {
  161.       return this.underline;
  162.    }
  163.  
  164.    public void setUnderline(int var1) {
  165.       this.underline = (byte)var1;
  166.       this.update(EAttribute.EUNDERLINE);
  167.    }
  168.  
  169.    public boolean getStrikethrough() {
  170.       return this.strikethrough;
  171.    }
  172.  
  173.    public void setStrikethrough(boolean var1) {
  174.       this.strikethrough = var1;
  175.       this.update(EAttribute.ESTRIKETHROUGH);
  176.    }
  177.  
  178.    public int getRunDirection() {
  179.       return this.runDirection;
  180.    }
  181.  
  182.    public void setRunDirection(int var1) {
  183.       this.runDirection = (byte)var1;
  184.       this.update(EAttribute.ERUN_DIRECTION);
  185.    }
  186.  
  187.    public int getBidiEmbedding() {
  188.       return this.bidiEmbedding;
  189.    }
  190.  
  191.    public void setBidiEmbedding(int var1) {
  192.       this.bidiEmbedding = (byte)var1;
  193.       this.update(EAttribute.EBIDI_EMBEDDING);
  194.    }
  195.  
  196.    public float getJustification() {
  197.       return this.justification;
  198.    }
  199.  
  200.    public void setJustification(float var1) {
  201.       this.justification = var1;
  202.       this.update(EAttribute.EJUSTIFICATION);
  203.    }
  204.  
  205.    public Object getInputMethodHighlight() {
  206.       return this.imHighlight;
  207.    }
  208.  
  209.    public void setInputMethodHighlight(Annotation var1) {
  210.       this.imHighlight = var1;
  211.       this.update(EAttribute.EINPUT_METHOD_HIGHLIGHT);
  212.    }
  213.  
  214.    public void setInputMethodHighlight(InputMethodHighlight var1) {
  215.       this.imHighlight = var1;
  216.       this.update(EAttribute.EINPUT_METHOD_HIGHLIGHT);
  217.    }
  218.  
  219.    public int getInputMethodUnderline() {
  220.       return this.imUnderline;
  221.    }
  222.  
  223.    public void setInputMethodUnderline(int var1) {
  224.       this.imUnderline = (byte)var1;
  225.       this.update(EAttribute.EINPUT_METHOD_UNDERLINE);
  226.    }
  227.  
  228.    public boolean getSwapColors() {
  229.       return this.swapColors;
  230.    }
  231.  
  232.    public void setSwapColors(boolean var1) {
  233.       this.swapColors = var1;
  234.       this.update(EAttribute.ESWAP_COLORS);
  235.    }
  236.  
  237.    public NumericShaper getNumericShaping() {
  238.       return this.numericShaping;
  239.    }
  240.  
  241.    public void setNumericShaping(NumericShaper var1) {
  242.       this.numericShaping = var1;
  243.       this.update(EAttribute.ENUMERIC_SHAPING);
  244.    }
  245.  
  246.    public int getKerning() {
  247.       return this.kerning;
  248.    }
  249.  
  250.    public void setKerning(int var1) {
  251.       this.kerning = (byte)var1;
  252.       this.update(EAttribute.EKERNING);
  253.    }
  254.  
  255.    public float getTracking() {
  256.       return this.tracking;
  257.    }
  258.  
  259.    public void setTracking(float var1) {
  260.       this.tracking = (float)((byte)((int)var1));
  261.       this.update(EAttribute.ETRACKING);
  262.    }
  263.  
  264.    public int getLigatures() {
  265.       return this.ligatures;
  266.    }
  267.  
  268.    public void setLigatures(int var1) {
  269.       this.ligatures = (byte)var1;
  270.       this.update(EAttribute.ELIGATURES);
  271.    }
  272.  
  273.    public AffineTransform getBaselineTransform() {
  274.       return this.baselineTransform;
  275.    }
  276.  
  277.    public AffineTransform getCharTransform() {
  278.       return this.charTransform;
  279.    }
  280.  
  281.    public static int getMask(EAttribute var0) {
  282.       return var0.mask;
  283.    }
  284.  
  285.    public static int getMask(EAttribute... var0) {
  286.       int var1 = 0;
  287.  
  288.       for(EAttribute var5 : var0) {
  289.          var1 |= var5.mask;
  290.       }
  291.  
  292.       return var1;
  293.    }
  294.  
  295.    public void unsetDefault() {
  296.       this.defined &= this.nondefault;
  297.    }
  298.  
  299.    public void defineAll(int var1) {
  300.       this.defined |= var1;
  301.       if ((this.defined & EAttribute.EBASELINE_TRANSFORM.mask) != 0) {
  302.          throw new InternalError("can't define derived attribute");
  303.       }
  304.    }
  305.  
  306.    public boolean allDefined(int var1) {
  307.       return (this.defined & var1) == var1;
  308.    }
  309.  
  310.    public boolean anyDefined(int var1) {
  311.       return (this.defined & var1) != 0;
  312.    }
  313.  
  314.    public boolean anyNonDefault(int var1) {
  315.       return (this.nondefault & var1) != 0;
  316.    }
  317.  
  318.    public boolean isDefined(EAttribute var1) {
  319.       return (this.defined & var1.mask) != 0;
  320.    }
  321.  
  322.    public boolean isNonDefault(EAttribute var1) {
  323.       return (this.nondefault & var1.mask) != 0;
  324.    }
  325.  
  326.    public void setDefault(EAttribute var1) {
  327.       if (var1.att == null) {
  328.          throw new InternalError("can't set default derived attribute: " + var1);
  329.       } else {
  330.          this.i_set(var1, DEFAULT);
  331.          this.defined |= var1.mask;
  332.          this.nondefault &= ~var1.mask;
  333.       }
  334.    }
  335.  
  336.    public void unset(EAttribute var1) {
  337.       if (var1.att == null) {
  338.          throw new InternalError("can't unset derived attribute: " + var1);
  339.       } else {
  340.          this.i_set(var1, DEFAULT);
  341.          this.defined &= ~var1.mask;
  342.          this.nondefault &= ~var1.mask;
  343.       }
  344.    }
  345.  
  346.    public void set(EAttribute var1, AttributeValues var2) {
  347.       if (var1.att == null) {
  348.          throw new InternalError("can't set derived attribute: " + var1);
  349.       } else {
  350.          if (var2 != null && var2 != DEFAULT) {
  351.             if ((var2.defined & var1.mask) != 0) {
  352.                this.i_set(var1, var2);
  353.                this.update(var1);
  354.             }
  355.          } else {
  356.             this.setDefault(var1);
  357.          }
  358.  
  359.       }
  360.    }
  361.  
  362.    public void set(EAttribute var1, Object var2) {
  363.       if (var1.att == null) {
  364.          throw new InternalError("can't set derived attribute: " + var1);
  365.       } else {
  366.          if (var2 != null) {
  367.             try {
  368.                this.i_set(var1, var2);
  369.                this.update(var1);
  370.                return;
  371.             } catch (Exception var4) {
  372.             }
  373.          }
  374.  
  375.          this.setDefault(var1);
  376.       }
  377.    }
  378.  
  379.    public Object get(EAttribute var1) {
  380.       if (var1.att == null) {
  381.          throw new InternalError("can't get derived attribute: " + var1);
  382.       } else {
  383.          return (this.nondefault & var1.mask) != 0 ? this.i_get(var1) : null;
  384.       }
  385.    }
  386.  
  387.    public AttributeValues merge(Map<? extends AttributedCharacterIterator.Attribute, ?> var1) {
  388.       return this.merge(var1, MASK_ALL);
  389.    }
  390.  
  391.    public AttributeValues merge(Map<? extends AttributedCharacterIterator.Attribute, ?> var1, int var2) {
  392.       if (var1 instanceof AttributeMap && ((AttributeMap)var1).getValues() != null) {
  393.          this.merge(((AttributeMap)var1).getValues(), var2);
  394.       } else if (var1 != null && !var1.isEmpty()) {
  395.          for(Map.Entry var4 : var1.entrySet()) {
  396.             EAttribute var5 = EAttribute.forAttribute((AttributedCharacterIterator.Attribute)var4.getKey());
  397.             if (var5 != null && (var2 & var5.mask) != 0) {
  398.                this.set(var5, var4.getValue());
  399.             }
  400.          }
  401.       }
  402.  
  403.       return this;
  404.    }
  405.  
  406.    public AttributeValues merge(AttributeValues var1) {
  407.       return this.merge(var1, MASK_ALL);
  408.    }
  409.  
  410.    public AttributeValues merge(AttributeValues var1, int var2) {
  411.       int var3 = var2 & var1.defined;
  412.  
  413.       for(EAttribute var7 : EAttribute.atts) {
  414.          if (var3 == 0) {
  415.             break;
  416.          }
  417.  
  418.          if ((var3 & var7.mask) != 0) {
  419.             var3 &= ~var7.mask;
  420.             this.i_set(var7, var1);
  421.             this.update(var7);
  422.          }
  423.       }
  424.  
  425.       return this;
  426.    }
  427.  
  428.    public static AttributeValues fromMap(Map<? extends AttributedCharacterIterator.Attribute, ?> var0) {
  429.       return fromMap(var0, MASK_ALL);
  430.    }
  431.  
  432.    public static AttributeValues fromMap(Map<? extends AttributedCharacterIterator.Attribute, ?> var0, int var1) {
  433.       return (new AttributeValues()).merge(var0, var1);
  434.    }
  435.  
  436.    public Map<TextAttribute, Object> toMap(Map<TextAttribute, Object> var1) {
  437.       if (var1 == null) {
  438.          var1 = new HashMap();
  439.       }
  440.  
  441.       int var2 = this.defined;
  442.  
  443.       for(int var3 = 0; var2 != 0; ++var3) {
  444.          EAttribute var4 = EAttribute.atts[var3];
  445.          if ((var2 & var4.mask) != 0) {
  446.             var2 &= ~var4.mask;
  447.             var1.put(var4.att, this.get(var4));
  448.          }
  449.       }
  450.  
  451.       return var1;
  452.    }
  453.  
  454.    public static boolean is16Hashtable(Hashtable<Object, Object> var0) {
  455.       return var0.containsKey("sun.font.attributevalues.defined_key");
  456.    }
  457.  
  458.    public static AttributeValues fromSerializableHashtable(Hashtable<Object, Object> var0) {
  459.       AttributeValues var1 = new AttributeValues();
  460.       if (var0 != null && !var0.isEmpty()) {
  461.          for(Map.Entry var3 : var0.entrySet()) {
  462.             Object var4 = var3.getKey();
  463.             Object var5 = var3.getValue();
  464.             if (var4.equals("sun.font.attributevalues.defined_key")) {
  465.                var1.defineAll((Integer)var5);
  466.             } else {
  467.                try {
  468.                   EAttribute var6 = EAttribute.forAttribute((AttributedCharacterIterator.Attribute)var4);
  469.                   if (var6 != null) {
  470.                      var1.set(var6, var5);
  471.                   }
  472.                } catch (ClassCastException var7) {
  473.                }
  474.             }
  475.          }
  476.       }
  477.  
  478.       return var1;
  479.    }
  480.  
  481.    public Hashtable<Object, Object> toSerializableHashtable() {
  482.       Hashtable var1 = new Hashtable();
  483.       int var2 = this.defined;
  484.       int var3 = this.defined;
  485.  
  486.       for(int var4 = 0; var3 != 0; ++var4) {
  487.          EAttribute var5 = EAttribute.atts[var4];
  488.          if ((var3 & var5.mask) != 0) {
  489.             var3 &= ~var5.mask;
  490.             Object var6 = this.get(var5);
  491.             if (var6 != null) {
  492.                if (var6 instanceof Serializable) {
  493.                   var1.put(var5.att, var6);
  494.                } else {
  495.                   var2 &= ~var5.mask;
  496.                }
  497.             }
  498.          }
  499.       }
  500.  
  501.       var1.put("sun.font.attributevalues.defined_key", var2);
  502.       return var1;
  503.    }
  504.  
  505.    public int hashCode() {
  506.       return this.defined << 8 ^ this.nondefault;
  507.    }
  508.  
  509.    public boolean equals(Object var1) {
  510.       try {
  511.          return this.equals((AttributeValues)var1);
  512.       } catch (ClassCastException var3) {
  513.          return false;
  514.       }
  515.    }
  516.  
  517.    public boolean equals(AttributeValues var1) {
  518.       if (var1 == null) {
  519.          return false;
  520.       } else if (var1 == this) {
  521.          return true;
  522.       } else {
  523.          return this.defined == var1.defined && this.nondefault == var1.nondefault && this.underline == var1.underline && this.strikethrough == var1.strikethrough && this.superscript == var1.superscript && this.width == var1.width && this.kerning == var1.kerning && this.tracking == var1.tracking && this.ligatures == var1.ligatures && this.runDirection == var1.runDirection && this.bidiEmbedding == var1.bidiEmbedding && this.swapColors == var1.swapColors && equals(this.transform, var1.transform) && equals(this.foreground, var1.foreground) && equals(this.background, var1.background) && equals(this.numericShaping, var1.numericShaping) && equals(this.justification, var1.justification) && equals(this.charReplacement, var1.charReplacement) && this.size == var1.size && this.weight == var1.weight && this.posture == var1.posture && equals(this.family, var1.family) && equals(this.font, var1.font) && this.imUnderline == var1.imUnderline && equals(this.imHighlight, var1.imHighlight);
  524.       }
  525.    }
  526.  
  527.    public AttributeValues clone() {
  528.       try {
  529.          AttributeValues var1 = (AttributeValues)super.clone();
  530.          if (this.transform != null) {
  531.             var1.transform = new AffineTransform(this.transform);
  532.             var1.updateDerivedTransforms();
  533.          }
  534.  
  535.          return var1;
  536.       } catch (CloneNotSupportedException var2) {
  537.          return null;
  538.       }
  539.    }
  540.  
  541.    public String toString() {
  542.       StringBuilder var1 = new StringBuilder();
  543.       var1.append('{');
  544.       int var2 = this.defined;
  545.  
  546.       for(int var3 = 0; var2 != 0; ++var3) {
  547.          EAttribute var4 = EAttribute.atts[var3];
  548.          if ((var2 & var4.mask) != 0) {
  549.             var2 &= ~var4.mask;
  550.             if (var1.length() > 1) {
  551.                var1.append(", ");
  552.             }
  553.  
  554.             var1.append(var4);
  555.             var1.append('=');
  556.             switch (1.$SwitchMap$sun$font$EAttribute[var4.ordinal()]) {
  557.                case 1:
  558.                   var1.append('"');
  559.                   var1.append(this.family);
  560.                   var1.append('"');
  561.                   break;
  562.                case 2:
  563.                   var1.append(this.weight);
  564.                   break;
  565.                case 3:
  566.                   var1.append(this.width);
  567.                   break;
  568.                case 4:
  569.                   var1.append(this.posture);
  570.                   break;
  571.                case 5:
  572.                   var1.append(this.size);
  573.                   break;
  574.                case 6:
  575.                   var1.append(this.transform);
  576.                   break;
  577.                case 7:
  578.                   var1.append(this.superscript);
  579.                   break;
  580.                case 8:
  581.                   var1.append(this.font);
  582.                   break;
  583.                case 9:
  584.                   var1.append(this.charReplacement);
  585.                   break;
  586.                case 10:
  587.                   var1.append(this.foreground);
  588.                   break;
  589.                case 11:
  590.                   var1.append(this.background);
  591.                   break;
  592.                case 12:
  593.                   var1.append(this.underline);
  594.                   break;
  595.                case 13:
  596.                   var1.append(this.strikethrough);
  597.                   break;
  598.                case 14:
  599.                   var1.append(this.runDirection);
  600.                   break;
  601.                case 15:
  602.                   var1.append(this.bidiEmbedding);
  603.                   break;
  604.                case 16:
  605.                   var1.append(this.justification);
  606.                   break;
  607.                case 17:
  608.                   var1.append(this.imHighlight);
  609.                   break;
  610.                case 18:
  611.                   var1.append(this.imUnderline);
  612.                   break;
  613.                case 19:
  614.                   var1.append(this.swapColors);
  615.                   break;
  616.                case 20:
  617.                   var1.append(this.numericShaping);
  618.                   break;
  619.                case 21:
  620.                   var1.append(this.kerning);
  621.                   break;
  622.                case 22:
  623.                   var1.append(this.ligatures);
  624.                   break;
  625.                case 23:
  626.                   var1.append(this.tracking);
  627.                   break;
  628.                default:
  629.                   throw new InternalError();
  630.             }
  631.  
  632.             if ((this.nondefault & var4.mask) == 0) {
  633.                var1.append('*');
  634.             }
  635.          }
  636.       }
  637.  
  638.       var1.append("[btx=" + this.baselineTransform + ", ctx=" + this.charTransform + "]");
  639.       var1.append('}');
  640.       return var1.toString();
  641.    }
  642.  
  643.    private static boolean equals(Object var0, Object var1) {
  644.       return var0 == null ? var1 == null : var0.equals(var1);
  645.    }
  646.  
  647.    private void update(EAttribute var1) {
  648.       this.defined |= var1.mask;
  649.       if (this.i_validate(var1)) {
  650.          if (this.i_equals(var1, DEFAULT)) {
  651.             this.nondefault &= ~var1.mask;
  652.          } else {
  653.             this.nondefault |= var1.mask;
  654.          }
  655.       } else {
  656.          this.setDefault(var1);
  657.       }
  658.  
  659.    }
  660.  
  661.    private void i_set(EAttribute var1, AttributeValues var2) {
  662.       switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
  663.          case 1:
  664.             this.family = var2.family;
  665.             break;
  666.          case 2:
  667.             this.weight = var2.weight;
  668.             break;
  669.          case 3:
  670.             this.width = var2.width;
  671.             break;
  672.          case 4:
  673.             this.posture = var2.posture;
  674.             break;
  675.          case 5:
  676.             this.size = var2.size;
  677.             break;
  678.          case 6:
  679.             this.transform = var2.transform;
  680.             this.updateDerivedTransforms();
  681.             break;
  682.          case 7:
  683.             this.superscript = var2.superscript;
  684.             break;
  685.          case 8:
  686.             this.font = var2.font;
  687.             break;
  688.          case 9:
  689.             this.charReplacement = var2.charReplacement;
  690.             break;
  691.          case 10:
  692.             this.foreground = var2.foreground;
  693.             break;
  694.          case 11:
  695.             this.background = var2.background;
  696.             break;
  697.          case 12:
  698.             this.underline = var2.underline;
  699.             break;
  700.          case 13:
  701.             this.strikethrough = var2.strikethrough;
  702.             break;
  703.          case 14:
  704.             this.runDirection = var2.runDirection;
  705.             break;
  706.          case 15:
  707.             this.bidiEmbedding = var2.bidiEmbedding;
  708.             break;
  709.          case 16:
  710.             this.justification = var2.justification;
  711.             break;
  712.          case 17:
  713.             this.imHighlight = var2.imHighlight;
  714.             break;
  715.          case 18:
  716.             this.imUnderline = var2.imUnderline;
  717.             break;
  718.          case 19:
  719.             this.swapColors = var2.swapColors;
  720.             break;
  721.          case 20:
  722.             this.numericShaping = var2.numericShaping;
  723.             break;
  724.          case 21:
  725.             this.kerning = var2.kerning;
  726.             break;
  727.          case 22:
  728.             this.ligatures = var2.ligatures;
  729.             break;
  730.          case 23:
  731.             this.tracking = var2.tracking;
  732.             break;
  733.          default:
  734.             throw new InternalError();
  735.       }
  736.  
  737.    }
  738.  
  739.    private boolean i_equals(EAttribute var1, AttributeValues var2) {
  740.       switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
  741.          case 1:
  742.             return equals(this.family, var2.family);
  743.          case 2:
  744.             return this.weight == var2.weight;
  745.          case 3:
  746.             return this.width == var2.width;
  747.          case 4:
  748.             return this.posture == var2.posture;
  749.          case 5:
  750.             return this.size == var2.size;
  751.          case 6:
  752.             return equals(this.transform, var2.transform);
  753.          case 7:
  754.             return this.superscript == var2.superscript;
  755.          case 8:
  756.             return equals(this.font, var2.font);
  757.          case 9:
  758.             return equals(this.charReplacement, var2.charReplacement);
  759.          case 10:
  760.             return equals(this.foreground, var2.foreground);
  761.          case 11:
  762.             return equals(this.background, var2.background);
  763.          case 12:
  764.             return this.underline == var2.underline;
  765.          case 13:
  766.             return this.strikethrough == var2.strikethrough;
  767.          case 14:
  768.             return this.runDirection == var2.runDirection;
  769.          case 15:
  770.             return this.bidiEmbedding == var2.bidiEmbedding;
  771.          case 16:
  772.             return this.justification == var2.justification;
  773.          case 17:
  774.             return equals(this.imHighlight, var2.imHighlight);
  775.          case 18:
  776.             return this.imUnderline == var2.imUnderline;
  777.          case 19:
  778.             return this.swapColors == var2.swapColors;
  779.          case 20:
  780.             return equals(this.numericShaping, var2.numericShaping);
  781.          case 21:
  782.             return this.kerning == var2.kerning;
  783.          case 22:
  784.             return this.ligatures == var2.ligatures;
  785.          case 23:
  786.             return this.tracking == var2.tracking;
  787.          default:
  788.             throw new InternalError();
  789.       }
  790.    }
  791.  
  792.    private void i_set(EAttribute var1, Object var2) {
  793.       switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
  794.          case 1:
  795.             this.family = ((String)var2).trim();
  796.             break;
  797.          case 2:
  798.             this.weight = ((Number)var2).floatValue();
  799.             break;
  800.          case 3:
  801.             this.width = ((Number)var2).floatValue();
  802.             break;
  803.          case 4:
  804.             this.posture = ((Number)var2).floatValue();
  805.             break;
  806.          case 5:
  807.             this.size = ((Number)var2).floatValue();
  808.             break;
  809.          case 6:
  810.             if (var2 instanceof TransformAttribute) {
  811.                TransformAttribute var4 = (TransformAttribute)var2;
  812.                if (var4.isIdentity()) {
  813.                   this.transform = null;
  814.                } else {
  815.                   this.transform = var4.getTransform();
  816.                }
  817.             } else {
  818.                this.transform = new AffineTransform((AffineTransform)var2);
  819.             }
  820.  
  821.             this.updateDerivedTransforms();
  822.             break;
  823.          case 7:
  824.             this.superscript = (byte)(Integer)var2;
  825.             break;
  826.          case 8:
  827.             this.font = (Font)var2;
  828.             break;
  829.          case 9:
  830.             this.charReplacement = (GraphicAttribute)var2;
  831.             break;
  832.          case 10:
  833.             this.foreground = (Paint)var2;
  834.             break;
  835.          case 11:
  836.             this.background = (Paint)var2;
  837.             break;
  838.          case 12:
  839.             this.underline = (byte)(Integer)var2;
  840.             break;
  841.          case 13:
  842.             this.strikethrough = (Boolean)var2;
  843.             break;
  844.          case 14:
  845.             if (var2 instanceof Boolean) {
  846.                this.runDirection = (byte)(TextAttribute.RUN_DIRECTION_LTR.equals(var2) ? 0 : 1);
  847.             } else {
  848.                this.runDirection = (byte)(Integer)var2;
  849.             }
  850.             break;
  851.          case 15:
  852.             this.bidiEmbedding = (byte)(Integer)var2;
  853.             break;
  854.          case 16:
  855.             this.justification = ((Number)var2).floatValue();
  856.             break;
  857.          case 17:
  858.             if (var2 instanceof Annotation) {
  859.                Annotation var3 = (Annotation)var2;
  860.                this.imHighlight = (InputMethodHighlight)var3.getValue();
  861.             } else {
  862.                this.imHighlight = (InputMethodHighlight)var2;
  863.             }
  864.             break;
  865.          case 18:
  866.             this.imUnderline = (byte)(Integer)var2;
  867.             break;
  868.          case 19:
  869.             this.swapColors = (Boolean)var2;
  870.             break;
  871.          case 20:
  872.             this.numericShaping = (NumericShaper)var2;
  873.             break;
  874.          case 21:
  875.             this.kerning = (byte)(Integer)var2;
  876.             break;
  877.          case 22:
  878.             this.ligatures = (byte)(Integer)var2;
  879.             break;
  880.          case 23:
  881.             this.tracking = ((Number)var2).floatValue();
  882.             break;
  883.          default:
  884.             throw new InternalError();
  885.       }
  886.  
  887.    }
  888.  
  889.    private Object i_get(EAttribute var1) {
  890.       switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
  891.          case 1:
  892.             return this.family;
  893.          case 2:
  894.             return this.weight;
  895.          case 3:
  896.             return this.width;
  897.          case 4:
  898.             return this.posture;
  899.          case 5:
  900.             return this.size;
  901.          case 6:
  902.             return this.transform == null ? TransformAttribute.IDENTITY : new TransformAttribute(this.transform);
  903.          case 7:
  904.             return Integer.valueOf(this.superscript);
  905.          case 8:
  906.             return this.font;
  907.          case 9:
  908.             return this.charReplacement;
  909.          case 10:
  910.             return this.foreground;
  911.          case 11:
  912.             return this.background;
  913.          case 12:
  914.             return Integer.valueOf(this.underline);
  915.          case 13:
  916.             return this.strikethrough;
  917.          case 14:
  918.             switch (this.runDirection) {
  919.                case 0:
  920.                   return TextAttribute.RUN_DIRECTION_LTR;
  921.                case 1:
  922.                   return TextAttribute.RUN_DIRECTION_RTL;
  923.                default:
  924.                   return null;
  925.             }
  926.          case 15:
  927.             return Integer.valueOf(this.bidiEmbedding);
  928.          case 16:
  929.             return this.justification;
  930.          case 17:
  931.             return this.imHighlight;
  932.          case 18:
  933.             return Integer.valueOf(this.imUnderline);
  934.          case 19:
  935.             return this.swapColors;
  936.          case 20:
  937.             return this.numericShaping;
  938.          case 21:
  939.             return Integer.valueOf(this.kerning);
  940.          case 22:
  941.             return Integer.valueOf(this.ligatures);
  942.          case 23:
  943.             return this.tracking;
  944.          default:
  945.             throw new InternalError();
  946.       }
  947.    }
  948.  
  949.    private boolean i_validate(EAttribute var1) {
  950.       switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
  951.          case 1:
  952.             if (this.family == null || this.family.length() == 0) {
  953.                this.family = DEFAULT.family;
  954.             }
  955.  
  956.             return true;
  957.          case 2:
  958.             return this.weight > 0.0F && this.weight < 10.0F;
  959.          case 3:
  960.             return this.width >= 0.5F && this.width < 10.0F;
  961.          case 4:
  962.             return this.posture >= -1.0F && this.posture <= 1.0F;
  963.          case 5:
  964.             return this.size >= 0.0F;
  965.          case 6:
  966.             if (this.transform != null && this.transform.isIdentity()) {
  967.                this.transform = DEFAULT.transform;
  968.             }
  969.  
  970.             return true;
  971.          case 7:
  972.             return this.superscript >= -7 && this.superscript <= 7;
  973.          case 8:
  974.             return true;
  975.          case 9:
  976.             return true;
  977.          case 10:
  978.             return true;
  979.          case 11:
  980.             return true;
  981.          case 12:
  982.             return this.underline >= -1 && this.underline < 6;
  983.          case 13:
  984.             return true;
  985.          case 14:
  986.             return this.runDirection >= -2 && this.runDirection <= 1;
  987.          case 15:
  988.             return this.bidiEmbedding >= -61 && this.bidiEmbedding < 62;
  989.          case 16:
  990.             this.justification = Math.max(0.0F, Math.min(this.justification, 1.0F));
  991.             return true;
  992.          case 17:
  993.             return true;
  994.          case 18:
  995.             return this.imUnderline >= -1 && this.imUnderline < 6;
  996.          case 19:
  997.             return true;
  998.          case 20:
  999.             return true;
  1000.          case 21:
  1001.             return this.kerning >= 0 && this.kerning <= 1;
  1002.          case 22:
  1003.             return this.ligatures >= 0 && this.ligatures <= 1;
  1004.          case 23:
  1005.             return this.tracking >= -1.0F && this.tracking <= 10.0F;
  1006.          default:
  1007.             throw new InternalError("unknown attribute: " + var1);
  1008.       }
  1009.    }
  1010.  
  1011.    public static float getJustification(Map<?, ?> var0) {
  1012.       if (var0 != null) {
  1013.          if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
  1014.             return ((AttributeMap)var0).getValues().justification;
  1015.          }
  1016.  
  1017.          Object var1 = var0.get(TextAttribute.JUSTIFICATION);
  1018.          if (var1 != null && var1 instanceof Number) {
  1019.             return Math.max(0.0F, Math.min(1.0F, ((Number)var1).floatValue()));
  1020.          }
  1021.       }
  1022.  
  1023.       return DEFAULT.justification;
  1024.    }
  1025.  
  1026.    public static NumericShaper getNumericShaping(Map<?, ?> var0) {
  1027.       if (var0 != null) {
  1028.          if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
  1029.             return ((AttributeMap)var0).getValues().numericShaping;
  1030.          }
  1031.  
  1032.          Object var1 = var0.get(TextAttribute.NUMERIC_SHAPING);
  1033.          if (var1 != null && var1 instanceof NumericShaper) {
  1034.             return (NumericShaper)var1;
  1035.          }
  1036.       }
  1037.  
  1038.       return DEFAULT.numericShaping;
  1039.    }
  1040.  
  1041.    public AttributeValues applyIMHighlight() {
  1042.       if (this.imHighlight != null) {
  1043.          Object var1 = null;
  1044.          InputMethodHighlight var4;
  1045.          if (this.imHighlight instanceof InputMethodHighlight) {
  1046.             var4 = (InputMethodHighlight)this.imHighlight;
  1047.          } else {
  1048.             var4 = (InputMethodHighlight)((Annotation)this.imHighlight).getValue();
  1049.          }
  1050.  
  1051.          Map var2 = var4.getStyle();
  1052.          if (var2 == null) {
  1053.             Toolkit var3 = Toolkit.getDefaultToolkit();
  1054.             var2 = var3.mapInputMethodHighlight(var4);
  1055.          }
  1056.  
  1057.          if (var2 != null) {
  1058.             return this.clone().merge(var2);
  1059.          }
  1060.       }
  1061.  
  1062.       return this;
  1063.    }
  1064.  
  1065.    public static AffineTransform getBaselineTransform(Map<?, ?> var0) {
  1066.       if (var0 != null) {
  1067.          AttributeValues var1 = null;
  1068.          if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
  1069.             var1 = ((AttributeMap)var0).getValues();
  1070.          } else if (var0.get(TextAttribute.TRANSFORM) != null) {
  1071.             var1 = fromMap(var0);
  1072.          }
  1073.  
  1074.          if (var1 != null) {
  1075.             return var1.baselineTransform;
  1076.          }
  1077.       }
  1078.  
  1079.       return null;
  1080.    }
  1081.  
  1082.    public static AffineTransform getCharTransform(Map<?, ?> var0) {
  1083.       if (var0 != null) {
  1084.          AttributeValues var1 = null;
  1085.          if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
  1086.             var1 = ((AttributeMap)var0).getValues();
  1087.          } else if (var0.get(TextAttribute.TRANSFORM) != null) {
  1088.             var1 = fromMap(var0);
  1089.          }
  1090.  
  1091.          if (var1 != null) {
  1092.             return var1.charTransform;
  1093.          }
  1094.       }
  1095.  
  1096.       return null;
  1097.    }
  1098.  
  1099.    public void updateDerivedTransforms() {
  1100.       if (this.transform == null) {
  1101.          this.baselineTransform = null;
  1102.          this.charTransform = null;
  1103.       } else {
  1104.          this.charTransform = new AffineTransform(this.transform);
  1105.          this.baselineTransform = extractXRotation(this.charTransform, true);
  1106.          if (this.charTransform.isIdentity()) {
  1107.             this.charTransform = null;
  1108.          }
  1109.  
  1110.          if (this.baselineTransform.isIdentity()) {
  1111.             this.baselineTransform = null;
  1112.          }
  1113.       }
  1114.  
  1115.       if (this.baselineTransform == null) {
  1116.          this.nondefault &= ~EAttribute.EBASELINE_TRANSFORM.mask;
  1117.       } else {
  1118.          this.nondefault |= EAttribute.EBASELINE_TRANSFORM.mask;
  1119.       }
  1120.  
  1121.    }
  1122.  
  1123.    public static AffineTransform extractXRotation(AffineTransform var0, boolean var1) {
  1124.       return extractRotation(new Point2D.Double((double)1.0F, (double)0.0F), var0, var1);
  1125.    }
  1126.  
  1127.    public static AffineTransform extractYRotation(AffineTransform var0, boolean var1) {
  1128.       return extractRotation(new Point2D.Double((double)0.0F, (double)1.0F), var0, var1);
  1129.    }
  1130.  
  1131.    private static AffineTransform extractRotation(Point2D.Double var0, AffineTransform var1, boolean var2) {
  1132.       var1.deltaTransform(var0, var0);
  1133.       AffineTransform var3 = AffineTransform.getRotateInstance(var0.x, var0.y);
  1134.  
  1135.       try {
  1136.          AffineTransform var4 = var3.createInverse();
  1137.          var1.preConcatenate(var4);
  1138.          if (var2) {
  1139.             double var5 = var1.getTranslateX();
  1140.             double var7 = var1.getTranslateY();
  1141.             if (var5 != (double)0.0F || var7 != (double)0.0F) {
  1142.                var1.setTransform(var1.getScaleX(), var1.getShearY(), var1.getShearX(), var1.getScaleY(), (double)0.0F, (double)0.0F);
  1143.                var3.setTransform(var3.getScaleX(), var3.getShearY(), var3.getShearX(), var3.getScaleY(), var5, var7);
  1144.             }
  1145.          }
  1146.  
  1147.          return var3;
  1148.       } catch (NoninvertibleTransformException var9) {
  1149.          return null;
  1150.       }
  1151.    }
  1152. }
  1153.